<head>
<base href="file:///liar.html">
<script>
function log(s) {
    document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
    if (window.parent == window.top) {
        window.parent.postMessage(s, '*');
    }
}

window.onload = function () {
    if (window.testRunner)
        testRunner.dumpAsText(); 

    var dragTarget = document.getElementById("dragTarget");

    dragTarget.ondragenter = function() {
        event.dataTransfer.dropEffect = "copy";
    }

    dragTarget.ondragover = function() {
        var url = event.dataTransfer.getData('URL');
        var result = url === ''
            ? "PASS: ondragover saw a URL of ''"
            : "FAIL: ondragover saw a URL of '" + url + "'";
        log(result);
        event.preventDefault();
    }
    
    dragTarget.ondrop = function() {
        event.preventDefault();
    }

    // Find abe
    var abe = document.getElementById("abe");
    var x1 = abe.offsetLeft + 50;
    var y1 = abe.offsetTop + 50;

    // Drag abe
    eventSender.mouseMoveTo(x1, y1);
    eventSender.mouseDown();
    eventSender.leapForward(500);
    eventSender.mouseMoveTo(x1 + 100, y1 - 100);
    eventSender.mouseUp();
}
</script>
</head>

<p>This page tests the URL the DOM sees while the user drags a file. If the test passes, you'll see a PASS message.</p>
<p>https://bugs.webkit.org/show_bug.cgi?id=25907 | rdar://problem/6910832.</p>
<div id="dragTarget" style="width: 200px; height: 200px; background-color: lightblue;">To test, drag Abe's image into this light blue div.</div>
<img id="abe" src="http://127.0.0.1:8000/security/resources/abe.png">
<pre id="console"></pre>
